﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Net;

namespace iMan
{
    [StructLayout(LayoutKind.Sequential)]
    public struct MIB_UDPSTATS
    {
        public int dwInDatagrams;
        public int dwNoPorts;
        public int dwInErrors;
        public int dwOutDatagrams;
        public int dwNumAddrs;
    }

    public struct MIB_UDPROW
    {
        public IPEndPoint Local;
    }

    public struct MIB_EXUDPROW
    {
        public IPEndPoint Local;
        public int dwProcessId;
        public string ProcessName;
    }

    public struct MIB_UDPTABLE
    {
        public int dwNumEntries;
        public MIB_UDPROW[] table;
    }

    public struct MIB_EXUDPTABLE
    {
        public int dwNumEntries;
        public MIB_EXUDPROW[] table;
    }

    [StructLayout(LayoutKind.Sequential)]
    public struct MIB_UDPROW_OWNER_PID
    {
        public IPEndPoint Local;
        public int dwOwningPid;
        public string ProcessName;
    }

    public struct MIB_UDPROW_OWNER_MODULE
    {
        public IPEndPoint Local;
        public uint dwOwningPid;
        public long liCreateTimestamp;
        public ulong[] OwningModuleInfo;
    }

    public struct MIB_UDPTABLE_OWNER_PID
    {
        public int dwNumEntries;
        public MIB_UDPROW_OWNER_PID[] table;
    }

    public struct _MIB_UDPTABLE_OWNER_MODULE
    {
        public uint dwNumEntries;
        public MIB_UDPROW_OWNER_MODULE[] table;
    }

    public enum UDP_TABLE_CLASS
    {
        UDP_TABLE_BASIC,
        UDP_TABLE_OWNER_PID,
        UDP_TABLE_OWNER_MODULE
    }
}
